package com.carbohydrate42.kotlin_compose_demo.page

import androidx.compose.foundation.layout.Column
import androidx.compose.material3.Button
import androidx.compose.material3.Text
import androidx.compose.runtime.Composable
import androidx.compose.runtime.collectAsState
import androidx.compose.runtime.getValue
import androidx.compose.ui.Modifier
import com.carbohydrate42.kotlin_compose_demo.MainState


@Composable
fun Page2(
    modifier: Modifier = Modifier,
) {
    val mainState: MainState = MainState.instance
    val shouldShowGlobalSnackBar by mainState.mainPageSnackBarVisible.collectAsState()

    Column {

        Button(onClick = { mainState.toggleMainPageSnackBarVisible() }) {
            Text(text = "toggleGlobalSnackBarVisible")
        }
        Text(text = "shouldShowGlobalSnackBar : $shouldShowGlobalSnackBar")
    }
}

